package com.mobialia.socialmediademo;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.SeekBar;

public class SocialMediaDemo extends Activity {
	
	public final static String TAG = "SocialMediaDemo";
	
	AudioManager audioManager;
	SeekBar voiceVolume, musicVolume;
	boolean running = false;

	/**
	 * Called to update
	 */
	Handler handler = new Handler() {
		@Override
		public void handleMessage(Message msg) {
			if (!running) return;
			handler.removeMessages(0);
			handler.sendMessageAtTime(Message.obtain(handler, 0), SystemClock.uptimeMillis() + 500);
		}
	};

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
		// No Titlebar
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		requestWindowFeature(Window.FEATURE_PROGRESS); 
		
		setContentView(R.layout.dashboard);
    }

    
    public void onResume() {
    	super.onResume();
		Log.d(TAG, "onResume()");
		
		running = true;
		
		handler.sendEmptyMessage(0);
    }
    
    public void onPause() {
    	super.onPause();
    	
    	running = false;
    	handler.removeMessages(0);
    }

    public void onShareAction(View v) {
		Intent intent = new Intent(getApplicationContext(), ShareActivity.class);
		startActivity(intent);
    }
    
    public void onTwitterAction(View v) {
		Intent intent = new Intent(getApplicationContext(), TwitterActivity.class);
		startActivity(intent);
    }
    
    public void onLinkedInAction(View v) {
		Intent intent = new Intent(getApplicationContext(), LinkedInActivity.class);
		startActivity(intent);
    }

    public void onGooglePlusAction(View v) {
		Intent intent = new Intent(getApplicationContext(), GooglePlusActivity.class);
		startActivity(intent);
    }
    
    public void onFacebookAction(View v) {    	
		Intent intent = new Intent(getApplicationContext(), FacebookActivity.class);
		startActivity(intent);
    }
    
    public void onAboutAction(View v) {    	
    	AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setCancelable(true);
		builder.setPositiveButton(R.string.dialog_yes, null);
		builder.setTitle(R.string.about_title);
		builder.setMessage(R.string.about_text);
		builder.create().show();
    }
}